<?php /* sample1 */
error_reporting(0);
?>
<?php if(isset($_POST['calculate-btn']))
{
$sum1 = $_POST['sum1'];
$sum2 = $_POST['sum2'];
$total = $sum1 * $sum2;
$sum3 = $_POST['sum3'];
$sum4 = $_POST['sum4'];
$total1 = $sum3 / $sum4;
$sum5 = $_POST['sum5'];
$sum6 = $_POST['sum6'];
$total2 = $sum5 + $sum6;
$sum7 = $_POST['sum7'];
$sum8 = $_POST['sum8'];
$total3 = $sum7 - $sum8;
$sum7 = $_POST['sum9'];
$sum8 = $_POST['sum10'];
$total4 = $sum9 - $sum10;
}

 ?>
<form action="sample1.php" method="post">
<input type="text" name="sum1" value="<?php echo $_POST['sum1']; ?>"/>
<span>*</span>
<input type="text" name="sum2" value="<?php echo $_POST['sum2']; ?>"/>
<span>=</span>
<?php echo $total;?><br><br>
<input type="text" name="sum3" value="<?php echo $_POST['sum3']; ?>"/>
<span>/</span>
<input type="text" name="sum4" value="<?php echo $_POST['sum4']; ?>" />
<span>=</span>
<?php echo $total1;?><br><br>
<input type="text" name="sum5" value="<?php echo $_POST['sum5']; ?>"/>
<span>+</span>
<input type="text" name="sum6" value="<?php echo $_POST['sum6']; ?>"/>
<span>=</span>
<?php echo $total2;?><br><br>
<input type="text" name="sum7" value="<?php echo $_POST['sum7']; ?>"/>
<span>-</span>
<input type="text" name="sum8" value="<?php echo $_POST['sum8']; ?>"/>
<span>=</span>
<?php echo $total3;?><br><br>
<input type="text" name="sum9" value="<?php echo $_POST['sum9']; ?>"/>
<span>%</span>
<input type="text" name="sum10" value="<?php echo $_POST['sum10']; ?>"/>
<span>=</span>
<?php echo $total4;?><br><br>
<input type="submit" name="calculate-btn" value="calculate" />
</form>

